<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
   
</head>
<body style="background-color: #F5F6F7">
<div class="container" style="background-color:white;margin-top: 20px">
    <form id="form" style="margin:10px 0px 10px">
        <span style="font-size:larger;color: black">修改快递</span>
        <hr style="border: black 1px solid">
        <div class="form-group">
            <label for="pageNum">快递编号:</label>
            <input type="text" class="form-control" name="pageNum" id="pageNum" readonly>
        </div>
        <div class="form-group">
            <label for="sendName">寄件人姓名:</label>
            <input type="text" class="form-control" name="sendName" id="sendName">
        </div>
        <div class="form-group">
            <label for="sendPhone">寄件人电话:</label>
            <input type="text" class="form-control" name="sendPhone" id="sendPhone" >
        </div>
        <div class="form-group">
            <label for="sendProvince">寄件人所属省份:</label>
            <input type="text" class="form-control" name="sendProvince" id="sendProvince">
        </div>
        <div class="form-group">
            <label for="sendCity">寄件人所属市:</label>
            <input type="text" class="form-control" name="sendCity" id="sendCity">
        </div>
        <div class="form-group">
            <label for="sendArea">寄件人所属区:</label>
            <input type="text" class="form-control" name="sendArea" id="sendArea" >
        </div>
        <div class="form-group">
            <label for="sendAddressDetail">寄件人详情地址:</label>
            <input type="text" class="form-control" name="sendAddress" id="sendAddressDetail">
        </div>
        <div class="form-group">
            <label for="receiveName">收件人姓名:</label>
            <input type="text" class="form-control" name="receiveName" id="receiveName" >
        </div>
        <div class="form-group">
            <label for="receivePhone">收件人电话:</label>
            <input type="text" class="form-control" name="receivePhone" id="receivePhone" >
        </div>

        <div class="form-group">
            <label for="receiveProvince">收件人所属省份:</label>
            <input type="text" class="form-control" name="receiveProvince" id="receiveProvince" >
        </div>
        <div class="form-group">
            <label for="receiveCity">收件人所属市:</label>
            <input type="text" class="form-control" name="receiveCity" id="receiveCity" >
        </div>
        <div class="form-group">
            <label for="receiveArea">收件人所属区:</label>
            <input type="text" class="form-control" name="receiveArea" id="receiveArea" >
        </div>
        <div class="form-group">
            <label for="receiveAddressDetail">收件人详情地址:</label>
            <input type="text" class="form-control" name="receiveAddress" id="receiveAddressDetail">
        </div>
        <div class="form-group">
            <label for="weight">重量:</label>
            <input type="number" class="form-control" name="weight" id="weight" min="1" >
        </div>
        <div class="form-group">
            <label for="remark">寄件备注:</label>
            <textarea class="form-control" name="remark" id="remark" ></textarea>
        </div>

    </form>
    <button  class="btn btn-danger form-control" id="submit">修改</button>
</div>
<script src="../js/jquery-3.3.1.min.js"></script>
<script src="../../configure.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/distpicker.data.js"></script>
<script src="../js/distpicker.js"></script>
<script>
    var search = window.location.search
    var arr = search.split("=")
    var pageNum = arr[1]
    console.log(pageNum)
    //根据传过来的订单编号获取订单信息
    $.post(url+"/admin/pageSelectByMulti","searchInput="+pageNum,function (data){
        console.log(data)
        if(data.code==1){

            $("#pageNum").val(data.data[0].pageNum)
            $("#sendName").val(data.data[0].sendName)
            $("#sendPhone").val(data.data[0].sendPhone)
            $("#sendProvince").val(data.data[0].sendProvince)
            $("#sendCity").val(data.data[0].sendCity)
            $("#sendArea").val(data.data[0].sendArea)
            $("#sendAddress").val(data.data[0].sendAddress)
            $("#receiveName").val(data.data[0].receiveName)
            $("#receivePhone").val(data.data[0].receivePhone)
            $("#receiveProvince").val(data.data[0].receiveProvince)
            $("#receiveCity").val(data.data[0].receiveCity)
            $("#receiveArea").val(data.data[0].receiveArea)
            $("#receiveAddress").val(data.data[0].receiveAddress)
            $("#weight").val(data.data[0].weight)
            $("#remark").val(data.data[0].remark)
        }else {
            alert("没有数据")
        }

    },"json")

    $("#submit").click(function () {
        var formData=$("#form").serialize()
        console.log(formData)
        $.post(url +"/admin/pageUpdate",formData,function (data) {
            console.log(data)
            if(data.code==1){
                alert("修改成功")
                location.href="test.html"

            }else if(data.code==2){
                alert("修改失败")
            }
        },"json")
    })

</script>
</body>
</html>